POV-Ray : Newsgroups : povray.general : area highlights : Re: area highlights Server Time
19 Nov 2024 22:36:14 EST (-0500)
  Re: area highlights  
From:
Date: 20 Dec 2001 04:00:29
Message: <ql932uco2d1mltnpkih5s6j38ibhri31a1@4ax.com>
On Wed, 19 Dec 2001 20:33:54 +0100, "Simon Adameit" <gom### [at] gmxde> wrote:
> I want to implement area highlights as a pigment.
> I get the intersection point and the direction of the normal from
> pigment functions. The reflected ray function also works, but I don't know
> how to vnormalize a vector that is three functions without using vnormalize
> because I'm not allowed to use vectors in functions.

You don't have to normalize IMO. You have to average scaled values just like
slopes.

I just checked to compare result of the averaged slopes and normal direction.
Looks like slope isn't proportional to view on Direction axis. But results is
similiar I think you should try with it. Here is testing scene:

#version 3.5;
#include "math.inc"
camera{location 0 look_at y spherical h_angle 360 v_angle 180}
light_source{0 color rgb 1}
// use first to return modified slope
#local P1=pigment{
  average
  pigment_map{
    [3 slope x color_map{[0 red   -3][1 red   3]}]
    [3 slope y color_map{[0 green -3][1 green 3]}]
    [3 slope z color_map{[0 blue  -3][1 blue  3]}]
  }
}
// use second to return normal direction
#local P2=pigment{
  average
  pigment_map{
    [3 function{adj_range2(-x,-1,1,0,1)} color_map{[0 red   -3][1 red   3]}]
    [3 function{adj_range2(-y,-1,1,0,1)} color_map{[0 green -3][1 green 3]}]
    [3 function{adj_range2(-z,-1,1,0,1)} color_map{[0 blue  -3][1 blue  3]}]
  }
}
sphere{0 1 pigment{P1} hollow} // change P1 to P2 when needed

//ABX


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.